﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Reactive.Subjects;

namespace RxCloud
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    internal class QueueNotifier : IQueueNotifier, IDisposable
    {
        public QueueNotifier()
        {
             this.MoreMessages = new Subject<string>();
             this.QueueCompleted = new Subject<string>();
        }
       

        public Subject<string> MoreMessages { get; private set; }

        public Subject<string> QueueCompleted { get; private set; }

        public void MessageAdded(string queueName)
        {
            MoreMessages.OnNext(queueName);
        }

        public void NoMoreMessages(string queueName)
        {
            QueueCompleted.OnNext(queueName);
        }

        public void Dispose()
        {
            MoreMessages.Dispose();
            QueueCompleted.Dispose();
        }
    }
}
